﻿using System;

using DreamCube.Foundation.Security;

namespace DreamCube.Framework.Utilities.Authorization
{
    public static class AuthoriseFactory
    {
        /// <summary>
        /// 根据类型创建授权方式
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static AuthoriseBasic CreateAuthorise(AuthoriseType type, ISecurity security)
        {
            switch (type)
            {
                case AuthoriseType.EviewsWithHardware:
                    return new AuthorizationWithHardware(security);
                case AuthoriseType.EviewsWithoutHardware:
                    return new AuthorizationWithoutHardware(security);
                case AuthoriseType.IntervalWithHardware:
                    return new ExpiryWithHardware(security);
                case AuthoriseType.IntervalWithoutHardware:
                    return new ExpiryWithoutHardware(security);
            }
            return null;
        }
    }
}
